package com.dlc.shop.distribution.api.controller;

import com.dlc.shop.bean.vo.DistributionConfigVO;
import com.dlc.shop.common.config.Constant;
import com.dlc.shop.common.response.ServerResponseEntity;
import com.dlc.shop.service.SysConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lgh on 2019/04/01.
 */
@RestController
@RequestMapping("/p/distribution/distributionBasicSet")
@Tag(name = "分销基本设置")
@AllArgsConstructor
public class DistributionBasicController {

    private final SysConfigService sysConfigService;

    @GetMapping("/canDistribution")
    @Operation(summary = "分销开关是否开启" , description = "获取分销开关是否开启，0关闭 1开启")
    public ServerResponseEntity<Integer> info(){
        DistributionConfigVO distributionConfigVO = sysConfigService.getSysConfigObject(Constant.DISTRIBUTION_CONFIG, DistributionConfigVO.class);
        return ServerResponseEntity.success(distributionConfigVO.getDistributionSwitch());
    }
}
